<%@ page import="com.zhiyou.util.UserUtil" %>
<%@ page import="com.zhiyou.entity.User" %>
<%@ page import="java.util.List" %>
<%@ page import="com.zhiyou.entity.PowerCenter" %><%--
  Created by IntelliJ IDEA.
  User: 磊布斯
  Date: 2021/9/10
  Time: 10:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    UserUtil userUtil = new UserUtil();
    //1.得到页码
    Integer pageIndex = Integer.parseInt(request.getParameter("pageIndex"));
    //判断页码是否越界
    //保存最大页数
    //数据库的数据在实时的变化,对应的总页数也会随着改变
    int pages = userUtil.getPages(2);
    if (pageIndex<=0){
        pageIndex=1;
    }
    if (pageIndex>pages){
        pageIndex=pages;
    }
    //2根据页码进行查询 把数据放在集合中
    List<PowerCenter> pcList = userUtil.getPageUsers(pageIndex);
    session.setAttribute("pcList",pcList);
    session.setAttribute("pages",pages);
    session.setAttribute("pageIndex",pageIndex);
    //页面跳转
    response.sendRedirect("/page/AccountManagement.jsp");
%>
</body>
</html>
